<?php
namespace App\Http\Controllers\Front;

use App\Http\Controllers\Controller;

class BaseController extends Controller
{
    //前台基础控制器

    /**
     * 接口返回
     */
    public function toJson($code = 0, $msg = '', $data = [], $total = 0)
    {
        if ($code == 0) $code = 200;
        if ($code == -2) $code = -102;
        if (!$msg) $msg = 'success';
        return [
            'code' => $code,
            'msg' => $msg,
            'data' => $data,
            'total' => $total,
        ];
    }
}